<?php
namespace app\index\controller;
use think\Controller;
class BaseController extends Controller
{
    public function _initialize()
    {

        // if(!$this->is_weixin())
        // {
        //     $this->redirect("/index.php" . url("index/index/index"));
        // }

        $config = cache('db_config_data');
        if (!$config)
        {
            $config = api('Config/lists');
            cache('db_config_data', $config);
        }
        config($config);
    }


    function is_weixin(){

        if ( strpos($_SERVER['HTTP_USER_AGENT'],
                'MicroMessenger') !== false ) {
            return true;

        }

        return false;

    }

}
